package com.wantupai.translate.activity;

import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;

import com.wantupai.translate.R;
import com.wantupai.translate.adapter.IdentificationAdapter;
import com.wantupai.translate.base.BaseActivity;

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * @author luxuchang
 * @date 2019/5/8 0008
 * @description
 */
public class MyIdentificationActivity extends BaseActivity {
    @BindView(R.id.lv_identification)
    ListView lvIdentification;
    @BindView(R.id.iv_right)
    ImageView ivRight;
    @BindView(R.id.tv_right)
    TextView tvRight;
    @BindView(R.id.ll_right)
    LinearLayout llRight;

    private ArrayList<String> list = new ArrayList<>(16);
    private IdentificationAdapter adapter;
    private boolean isChecked;

    @Override
    protected boolean translucentStatusBar() {
        return true;
    }

    @Override
    public int getLayoutId() {
        return R.layout.activity_my_identification;
    }

    @Override
    public void initViews() {
        setTitle("我的识别");
        llRight.setVisibility(View.VISIBLE);
        ivRight.setVisibility(View.GONE);
        tvRight.setVisibility(View.VISIBLE);
        tvRight.setText("管理");
        getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
        adapter = new IdentificationAdapter(this, list);
        lvIdentification.setAdapter(adapter);
    }

    @Override
    public void initListener() {

    }

    @Override
    public void initData() {

    }

    @Override
    public void processClick(View v) {

    }

    @OnClick(R.id.ll_right)
    public void onViewClicked() {
        if (!isChecked) {
            tvRight.setText("完成");
            adapter.status = isChecked = true;
        } else {
            adapter.status = isChecked = false;
            tvRight.setText("管理");
        }
        adapter.notifyDataSetChanged();
    }
}
